Hi AZ,
Disabling the axis for a few microseconds will not be a problem. That is even less than a normal servo sample time of 90us.
Regards TK
Group: DynoMotion |
Message: 7425 |
From: cristian_atzori |
Date: 5/3/2013 |
Subject: Re: Homing without disabling axis? |
You are right, few microseconds are not a problem in terms of motion, but are enough to trigger my safety circuit (discussed few post ago) which cuts off power to the drives if any of them is disabled (and keeps them shut down even if re-enabled).
Every time an axis is enabled it also switches on a bit (152,153,154) that forms a series of NO contacts closed only if all axes are enabled (and then with closed loop active).
I used this to prevent the runaway when the axis are unassisted and disabled for any reason by Kflop (max error etc.).
Maybe I found a solution for this, I think I'll use an additional bit to trigger a rele' (NO) that bypasses my security chain keepin it closed for just that microseconds needed for zeroing.
Maybe something like this can do the job?
#include "KMotionDef.h"
//Plugin calls for Mach3 Home (actually Purge) Commands
//Called from Mach3 "REF" command
//in this case just Zero the measured position (encoder)
//and set the commanded destination to zero
#define X 0
#define Y 1
#define Z 2
main()
{
int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
printf("Mach3 Home Call, flags = %d\n",flags);
if (flags & 1)
{
SetBit(157);
DisableAxis(X);
Zero(X);
EnableAxisDest(X,0.0);
ClearBit(157);
}
if (flags & 2)
{
SetBit(157);
DisableAxis(Y);
Zero(Y);
EnableAxisDest(Y,0.0);
ClearBit(157);
}
if (flags & 4)
{
SetBit(157);
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
ClearBit(157);
Jog(Z,10000); // start moving
while (ReadBit(138)) ; // wait for switch (input #138) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(Z,-3000); // start moving
while (!ReadBit(138)) ; // wait for switch (input #138) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Delay_sec(.25);
SetBit(157);
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
ClearBit(157);
}
}
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 Home (actually Purge) Commands
> //Called from Mach3 "REF" command
> //in this case just Zero the measured position (encoder)
> //and set the commanded destination to zero
>
> #define X 0
> #define Y 1
> #define Z 2
>
> main()
> {
> int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
>
> printf("Mach3 Home Call, flags = %d\n",flags);
>
> if (flags & 1)
> {
> DisableAxis(X);
> Zero(X);
> EnableAxisDest(X,0.0);
> }
> if (flags & 2)
> {
> DisableAxis(Y);
> Zero(Y);
> EnableAxisDest(Y,0.0);
> }
> if (flags & 4)
> {
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> }
> }
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi AZ,
>
> Disabling the axis for a few microseconds will not be a problem. That is even less than a normal servo sample time of 90us.
>
> Regards
> TK
>
>
>
> ________________________________
> From: cristian_atzori <cristian_atzori@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, May 2, 2013 1:53 PM
> Subject: [DynoMotion] Homing without disabling axis?
>
>
>
> Â
>
> Is it possible to create a code that allows homing (mechanical switches) without disabling any axis?
> I've some big dc brushed motor with tacheometer onboard, driven in closed loop with glass scales.
> It happens that when Kflop is not closing the loop (disabled axis) the motor has a slow runwaway.
> As you can imagine I'm a bit afraid of using the typical homing codes, where the axis is disabled before zeroing.
>
> If I can assume a constant runaway and an identical time frame between disabling and zeroing then that would be ok, but I would like to find another way to do the homing sequence, if possibile.
>
> Any suggestion would be higly appreciated.
>
> ps: actually I can't eliminate the runaway, the drives are old and they need to be totally rebuilt (capacitors in primis).
>
> Thank you
>
> This is the code I'm referring to (HomeEncoderMach3.c):
>
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 Home (actually Purge) Commands
> //Called from Mach3 "REF" command
> //in this case just Zero the measured position (encoder)
> //and set the commanded destination to zero
>
> #define X 0
> #define Y 1
> #define Z 2
>
> main()
> {
> int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
>
> printf("Mach3 Home Call, flags = %d\n",flags);
>
> if (flags & 1)
> {
> DisableAxis(X);
> Zero(X);
> EnableAxisDest(X,0.0);
> }
> if (flags & 2)
> {
> DisableAxis(Y);
> Zero(Y);
> EnableAxisDest(Y,0.0);
> }
> if (flags & 4)
> {
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> }
> }
>
|
|
Group: DynoMotion |
Message: 7426 |
From: cristian_atzori |
Date: 5/3/2013 |
Subject: Re: Homing without disabling axis? |
This is an opportunity to try virtual bits, they are for sure faster than any relais :)
Tom please tell me is it's correct to correlate these two codes (homing and whatchenable):
#include "KMotionDef.h"
//Plugin calls for Mach3 Home (actually Purge) Commands
//Called from Mach3 "REF" command
//in this case just Zero the measured position (encoder)
//and set the commanded destination to zero
#define X 0
#define Y 1
#define Z 2
main()
{
int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
printf("Mach3 Home Call, flags = %d\n",flags);
if (flags & 1)
{
SetBit(63);
DisableAxis(X);
Zero(X);
EnableAxisDest(X,0.0);
ClearBit(63);
}
if (flags & 2)
{
SetBit(63);
DisableAxis(Y);
Zero(Y);
EnableAxisDest(Y,0.0);
ClearBit(63);
}
if (flags & 4)
{
SetBit(63);
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
ClearBit(63);
Jog(Z,10000); // start moving
while (ReadBit(138)) ; // wait for switch (input #138) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(Z,-3000); // start moving
while (!ReadBit(138)) ; // wait for switch (input #138) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Delay_sec(.25);
SetBit(63);
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
ClearBit(63);
}
}
----this is the watchenable that controls the enable condition-----
#include "KMotionDef.h"
main()
{
for (;;) //loop forever
{
WaitNextTimeSlice();
if (!ch0->Enable && !ReadBit(63)) //if X is disabled turns off bit 152 (jp8)
ClearBit(152);
}
if (!ch1->Enable && !ReadBit(63)) //if Y is disabled turns off bit 153 (jp8)
ClearBit(153);
if (!ch2->Enable && !ReadBit(63)) //if Z is disabled turns off il bit 154 (jp8)
ClearBit(154);
}
--- In DynoMotion@yahoogroups.com, "cristian_atzori" <cristian_atzori@...> wrote:
>
> You are right, few microseconds are not a problem in terms of motion, but are enough to trigger my safety circuit (discussed few post ago) which cuts off power to the drives if any of them is disabled (and keeps them shut down even if re-enabled).
>
> Every time an axis is enabled it also switches on a bit (152,153,154) that forms a series of NO contacts closed only if all axes are enabled (and then with closed loop active).
> I used this to prevent the runaway when the axis are unassisted and disabled for any reason by Kflop (max error etc.).
>
> Maybe I found a solution for this, I think I'll use an additional bit to trigger a rele' (NO) that bypasses my security chain keepin it closed for just that microseconds needed for zeroing.
>
> Maybe something like this can do the job?
>
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 Home (actually Purge) Commands
> //Called from Mach3 "REF" command
> //in this case just Zero the measured position (encoder)
> //and set the commanded destination to zero
>
> #define X 0
> #define Y 1
> #define Z 2
>
> main()
> {
> int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
>
> printf("Mach3 Home Call, flags = %d\n",flags);
>
> if (flags & 1)
> {
> SetBit(157);
> DisableAxis(X);
> Zero(X);
> EnableAxisDest(X,0.0);
> ClearBit(157);
> }
> if (flags & 2)
> {
> SetBit(157);
> DisableAxis(Y);
> Zero(Y);
> EnableAxisDest(Y,0.0);
> ClearBit(157);
> }
> if (flags & 4)
> {
> SetBit(157);
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> ClearBit(157);
>
> Jog(Z,10000); // start moving
> while (ReadBit(138)) ; // wait for switch (input #138) to change
> Jog(Z,0); // StopMotion
>
> while(!CheckDone(Z)) ;
>
> Jog(Z,-3000); // start moving
> while (!ReadBit(138)) ; // wait for switch (input #138) to change
> Jog(Z,0); // StopMotion
>
> while(!CheckDone(Z)) ;
> Delay_sec(.25);
>
> SetBit(157);
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> ClearBit(157);
> }
> }
>
>
>
>
>
>
>
>
>
> > #include "KMotionDef.h"
> >
> > //Plugin calls for Mach3 Home (actually Purge) Commands
> > //Called from Mach3 "REF" command
> > //in this case just Zero the measured position (encoder)
> > //and set the commanded destination to zero
> >
> > #define X 0
> > #define Y 1
> > #define Z 2
> >
> > main()
> > {
> > int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
> >
> > printf("Mach3 Home Call, flags = %d\n",flags);
> >
> > if (flags & 1)
> > {
> > DisableAxis(X);
> > Zero(X);
> > EnableAxisDest(X,0.0);
> > }
> > if (flags & 2)
> > {
> > DisableAxis(Y);
> > Zero(Y);
> > EnableAxisDest(Y,0.0);
> > }
> > if (flags & 4)
> > {
> > DisableAxis(Z);
> > Zero(Z);
> > EnableAxisDest(Z,0.0);
> > }
> > }
>
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi AZ,
> >
> > Disabling the axis for a few microseconds will not be a problem. That is even less than a normal servo sample time of 90us.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: cristian_atzori <cristian_atzori@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, May 2, 2013 1:53 PM
> > Subject: [DynoMotion] Homing without disabling axis?
> >
> >
> >
> > Â
> >
> > Is it possible to create a code that allows homing (mechanical switches) without disabling any axis?
> > I've some big dc brushed motor with tacheometer onboard, driven in closed loop with glass scales.
> > It happens that when Kflop is not closing the loop (disabled axis) the motor has a slow runwaway.
> > As you can imagine I'm a bit afraid of using the typical homing codes, where the axis is disabled before zeroing.
> >
> > If I can assume a constant runaway and an identical time frame between disabling and zeroing then that would be ok, but I would like to find another way to do the homing sequence, if possibile.
> >
> > Any suggestion would be higly appreciated.
> >
> > ps: actually I can't eliminate the runaway, the drives are old and they need to be totally rebuilt (capacitors in primis).
> >
> > Thank you
> >
> > This is the code I'm referring to (HomeEncoderMach3.c):
> >
> > #include "KMotionDef.h"
> >
> > //Plugin calls for Mach3 Home (actually Purge) Commands
> > //Called from Mach3 "REF" command
> > //in this case just Zero the measured position (encoder)
> > //and set the commanded destination to zero
> >
> > #define X 0
> > #define Y 1
> > #define Z 2
> >
> > main()
> > {
> > int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
> >
> > printf("Mach3 Home Call, flags = %d\n",flags);
> >
> > if (flags & 1)
> > {
> > DisableAxis(X);
> > Zero(X);
> > EnableAxisDest(X,0.0);
> > }
> > if (flags & 2)
> > {
> > DisableAxis(Y);
> > Zero(Y);
> > EnableAxisDest(Y,0.0);
> > }
> > if (flags & 4)
> > {
> > DisableAxis(Z);
> > Zero(Z);
> > EnableAxisDest(Z,0.0);
> > }
> > }
> >
>
|
|
Group: DynoMotion |
Message: 7428 |
From: Tom Kerekes |
Date: 5/3/2013 |
Subject: Re: Homing without disabling axis? |
Hi AZ,
I think you are trying to find a solution to a problem that doesn't exist. The axis would have to remain disabled for a relatively long time before your other program would have time to detect it being disabled and then change the output to disable the amplifier. So the amplifier would never be disabled at all. Try it first to see if there is any problem.
Regards TK
Group: DynoMotion |
Message: 7429 |
From: cristian_atzori |
Date: 5/3/2013 |
Subject: Re: Homing without disabling axis? |
The machine is not near me, so I've to program before and try later.
I've seen that using my home switches also as limits, with the option "Disallow drive into limit", the switch is hit for a very short period of time, and then the axis runs back in order to let the switch close (I look at the I/O panel in Kmotion).
I thought that if that fraction of time is enough to trigger the relais maybe also the homing sequence could do the same.
I'll try as soon as possibile, check for any issue and then use the least number of lines.
Thank you again Tom.
C.Atzori
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi AZ,
>
> I think you are trying to find a solution to a problem that doesn't exist. The axis would have to remain disabled for a relatively long time before your other program would have time to detect it being disabled and then change the output to disable the amplifier. So the amplifier would never be disabled at all. Try it first to see if there is any problem.
>
> Regards
> TKÂ
>
>
>
> ________________________________
> From: cristian_atzori <cristian_atzori@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, May 3, 2013 1:23 PM
> Subject: [DynoMotion] Re: Homing without disabling axis?
>
>
>
> Â
> You are right, few microseconds are not a problem in terms of motion, but are enough to trigger my safety circuit (discussed few post ago) which cuts off power to the drives if any of them is disabled (and keeps them shut down even if re-enabled).
>
> Every time an axis is enabled it also switches on a bit (152,153,154) that forms a series of NO contacts closed only if all axes are enabled (and then with closed loop active).
> I used this to prevent the runaway when the axis are unassisted and disabled for any reason by Kflop (max error etc.).
>
> Maybe I found a solution for this, I think I'll use an additional bit to trigger a rele' (NO) that bypasses my security chain keepin it closed for just that microseconds needed for zeroing.
>
> Maybe something like this can do the job?
>
> #include "KMotionDef.h"
>
> //Plugin calls for Mach3 Home (actually Purge) Commands
> //Called from Mach3 "REF" command
> //in this case just Zero the measured position (encoder)
> //and set the commanded destination to zero
>
> #define X 0
> #define Y 1
> #define Z 2
>
> main()
> {
> int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
>
> printf("Mach3 Home Call, flags = %d\n",flags);
>
> if (flags & 1)
> {
> SetBit(157);
> DisableAxis(X);
> Zero(X);
> EnableAxisDest(X,0.0);
> ClearBit(157);
> }
> if (flags & 2)
> {
> SetBit(157);
> DisableAxis(Y);
> Zero(Y);
> EnableAxisDest(Y,0.0);
> ClearBit(157);
> }
> if (flags & 4)
> {
> SetBit(157);
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> ClearBit(157);
>
> Jog(Z,10000); // start moving
> while (ReadBit(138)) ; // wait for switch (input #138) to change
> Jog(Z,0); // StopMotion
>
> while(!CheckDone(Z)) ;
>
> Jog(Z,-3000); // start moving
> while (!ReadBit(138)) ; // wait for switch (input #138) to change
> Jog(Z,0); // StopMotion
>
> while(!CheckDone(Z)) ;
> Delay_sec(.25);
>
> SetBit(157);
> DisableAxis(Z);
> Zero(Z);
> EnableAxisDest(Z,0.0);
> ClearBit(157);
> }
> }
>
> > #include "KMotionDef.h"
> >
> > //Plugin calls for Mach3 Home (actually Purge) Commands
> > //Called from Mach3 "REF" command
> > //in this case just Zero the measured position (encoder)
> > //and set the commanded destination to zero
> >
> > #define X 0
> > #define Y 1
> > #define Z 2
> >
> > main()
> > {
> > int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
> >
> > printf("Mach3 Home Call, flags = %d\n",flags);
> >
> > if (flags & 1)
> > {
> > DisableAxis(X);
> > Zero(X);
> > EnableAxisDest(X,0.0);
> > }
> > if (flags & 2)
> > {
> > DisableAxis(Y);
> > Zero(Y);
> > EnableAxisDest(Y,0.0);
> > }
> > if (flags & 4)
> > {
> > DisableAxis(Z);
> > Zero(Z);
> > EnableAxisDest(Z,0.0);
> > }
> > }
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi AZ,
> >
> > Disabling the axis for a few microseconds will not be a problem.ÃÂ That is even less than a normal servo sample time of 90us.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: cristian_atzori <cristian_atzori@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, May 2, 2013 1:53 PM
> > Subject: [DynoMotion] Homing without disabling axis?
> >
> >
> >
> > ÃÂ
> >
> > Is it possible to create a code that allows homing (mechanical switches) without disabling any axis?
> > I've some big dc brushed motor with tacheometer onboard, driven in closed loop with glass scales.
> > It happens that when Kflop is not closing the loop (disabled axis) the motor has a slow runwaway.
> > As you can imagine I'm a bit afraid of using the typical homing codes, where the axis is disabled before zeroing.
> >
> > If I can assume a constant runaway and an identical time frame between disabling and zeroing then that would be ok, but I would like to find another way to do the homing sequence, if possibile.
> >
> > Any suggestion would be higly appreciated.
> >
> > ps: actually I can't eliminate the runaway, the drives are old and they need to be totally rebuilt (capacitors in primis).
> >
> > Thank you
> >
> > This is the code I'm referring to (HomeEncoderMach3.c):
> >
> > #include "KMotionDef.h"
> >
> > //Plugin calls for Mach3 Home (actually Purge) Commands
> > //Called from Mach3 "REF" command
> > //in this case just Zero the measured position (encoder)
> > //and set the commanded destination to zero
> >
> > #define X 0
> > #define Y 1
> > #define Z 2
> >
> > main()
> > {
> > int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
> >
> > printf("Mach3 Home Call, flags = %d\n",flags);
> >
> > if (flags & 1)
> > {
> > DisableAxis(X);
> > Zero(X);
> > EnableAxisDest(X,0.0);
> > }
> > if (flags & 2)
> > {
> > DisableAxis(Y);
> > Zero(Y);
> > EnableAxisDest(Y,0.0);
> > }
> > if (flags & 4)
> > {
> > DisableAxis(Z);
> > Zero(Z);
> > EnableAxisDest(Z,0.0);
> > }
> > }
> >
>
|
|
| | | |